namespace System.Utility.Security
{
	public class WinSecurityService
	{
		public static bool IsAuthenticated;

		public static int RoleId
		{
			get
			{
				return UserInfo.RoleId;
			}
		}

		public static string UserId
		{
			get
			{
				return UserInfo.UserId;
			}
		}

		public static UserInfo UserInfo
		{
			get;
			private set;
		}

		public static string UserName
		{
			get
			{
				return UserInfo.UserName;
			}
		}

		static WinSecurityService()
		{
			IsAuthenticated = false;
			UserInfo = new UserInfo();
		}

		public WinSecurityService()
		{
		}

		public static void SignIn(string userId, string userName, int roleId = 0)
		{
			UserInfo.UserId = userId;
			UserInfo.UserName = userName;
			UserInfo.RoleId = roleId;
			IsAuthenticated = true;
		}

		public static void SignOut()
		{
			if (IsAuthenticated)
			{
				UserInfo.UserId = string.Empty;
				UserInfo.UserName = string.Empty;
				UserInfo.RoleId = 0;
				IsAuthenticated = false;
			}
		}
	}
}